/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Gael
 */@Entity
 @XmlRootElement
@NamedQueries({
    @NamedQuery(name="OperationBancaire.findAll", query="select ob from OperationBancaire ob"),
    @NamedQuery(name="OperationBancaire.findById", query="select ob from OperationBancaire ob where ob.id = :compteid")
})
public class OperationBancaire implements Serializable {  
    private static final long serialVersionUID = 1L;  
    @Id  
    @GeneratedValue(strategy = GenerationType.AUTO)  
    private int id;  
    private String description;  
     @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateOperation;
    private int montant;  

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getDateOperation() {
        return dateOperation;
    }

    public void setDateOperation(Date dateOperation) {
        this.dateOperation = dateOperation;
    }

    public int getMontant() {
        return montant;
    }

    public void setMontant(int montant) {
        this.montant = montant;
    }
  
    public boolean isPositive(){
        if(this.montant >0){
            return true;
        }else{
            return false;
        }
    }
    public OperationBancaire() { }  
  
    public OperationBancaire(String description, int montant) {  
        this.description = description;  
        this.montant = montant;  
        dateOperation = new Date();  
    }  
}